package men.adg666.momo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import static android.icu.lang.UCharacter.GraphemeClusterBreak.V;

public class ModeChoose extends AppCompatActivity {
  private Button Random20;
  private Button All;
  private int pages;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mode_choose);
        Intent intent = getIntent();
        pages = intent.getIntExtra("pages",0);
        Random20 = findViewById(R.id.Random20_btn);
        All = findViewById(R.id.All_btn);
        Random20.setOnClickListener(onClickListener);
        All.setOnClickListener(onClickListener);
    }
   View.OnClickListener onClickListener = new View.OnClickListener() {
        int mode;
       @Override
       public void onClick(View v) {
           switch (v.getId()){
               case R.id.Random20_btn:mode = 2;//随机20个模式为2
                   break;
               case R.id.All_btn:mode = 1;//全部默写为1
                   break;
           }
           Intent intent = new Intent(ModeChoose.this,WordActivity.class);
           intent.putExtra("mode",mode);
           intent.putExtra("pages",pages);
           startActivity(intent);


       }
   };
}
